package com.hucsmn.phone;

/**
 * 流量套餐测试类。
 */
public class TrafficPlanTest extends Tester {
    private static final long GB = 1024L * 1024L * 1024L;

    public static void main(String[] args) {
        TrafficPlan tp = new TrafficPlan(1024, 2.0);

        asserts(tp.getTraffic() == 1024);
        asserts(tp.getCost() == 2.0);

        tp.setTraffic(2 * GB);
        tp.setCost(10.0);

        asserts(tp.getTraffic() == 2 * GB);
        asserts(tp.getCost() == 10.0);

        NetworkService ns = tp;
        Card card = new Card(CardKind.BIG, 10086, "YD", "passwd", 50.0, 0.0, 0L);
        asserts(card.getTraffic() == 0);
        ns.accumulateTraffic(GB, card);
        asserts(card.getTraffic() == GB);
    }
}
